package ${package}controller;


import ${package}pojo.${pojo_name_query_param};
import ${package}pojo.${pojo_name_vo};
import ${package}pojo.PageDTO;
import ${package}pojo.ResultBean;
import com.han.entity.SystemLog;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;


import ${package}services.${pojo_name_service};


/**
* @auth Auto generate
* @time ${gen_time}
*/

@RestController
@RequestMapping(value="${requestUrlPrefix}${pojo_name ? uncap_first}")
@Api(tags = "${table_remark}")
public class ${pojo_name}Controller{


    @Autowired
    private ${pojo_name_service} ${pojo_name ? uncap_first}Service;

    /**
    * 新增
    * @author Auto generate
    * @date ${gen_time}
    **/
    @SystemLog("${table_remark} 新增")
    @ApiOperation(value = "新增")
    @PostMapping("/insert")
    public ResultBean insert(@RequestBody ${pojo_name_vo} ${pojo_field_name_vo}){
        return ${pojo_name ? uncap_first}Service.insert(${pojo_field_name_vo});
    }

    /**
    * 刪除
    * @author Auto generate
    * @date ${gen_time}
    **/
    @SystemLog("${table_remark} 刪除")
    @ApiOperation(value = "刪除")
    @DeleteMapping("/delete/{id}")
    public ResultBean delete(@PathVariable Integer id){
        return ${pojo_name ? uncap_first}Service.delete(id);
    }
    /**
    * 批量删除
    * @author Auto generate
    * @date ${gen_time}
    **/
    @SystemLog("${table_remark} 批量删除")
    @ApiOperation(value = "批量删除")
    @DeleteMapping("/batchDelete/{ids}")
    public ResultBean batchDelete(@PathVariable List<Integer> ids){
        return ${pojo_name ? uncap_first}Service.batchDelete(ids);
    }

    /**
    * 编辑
    * @author Auto generate
    * @date ${gen_time}
    **/
    @SystemLog("${table_remark} 编辑")
    @ApiOperation(value = "编辑")
    @PutMapping("/update/{id}")
    public ResultBean update(@RequestBody ${pojo_name_vo} ${pojo_field_name_vo},@PathVariable Integer id){
            ${pojo_field_name_vo}.setId(id);
        return ${pojo_name ? uncap_first}Service.update(${pojo_field_name_vo});
    }

    /**
    * 详情查询
    * @author Auto generate
    * @date ${gen_time}
    **/
    @ApiOperation(value = "详情查询")
    @GetMapping("/details/{id}")
    public ResultBean<${pojo_name_vo}> details(@PathVariable Integer id){
        return ${pojo_name ? uncap_first}Service.details(id);
    }

    /**
    * 查询 分页查询
    * @author Auto generate
    * @date ${gen_time}
    **/
    @ApiOperation(value = "分页查询")
    @GetMapping("/pageList")
    public PageDTO<${pojo_name_vo}> pageList(${pojo_name_query_param} ${pojo_field_name_query_param}) {
        return ${pojo_name ? uncap_first}Service.pageList(${pojo_field_name_query_param});
    }

    /**
    * excel 模版下载
    * @author Auto generate
    * @date ${gen_time}
    **/
    @SystemLog("${table_remark} excel 模版下载")
    @ApiOperation(value = "excel 模版下载")
    @GetMapping("/excelTemplate")
    public void excelTemplate(HttpServletRequest request,HttpServletResponse response){
        ${pojo_name ? uncap_first}Service.excelTemplate(request,response);
    }

    /**
    * excel 数据导入
    * @author Auto generate
    * @date ${gen_time}
    **/
    @SystemLog("${table_remark} excel 数据导入")
    @ApiOperation(value = "excel 数据导入")
    @PostMapping("/excelImport")
    public ResultBean excelImport(MultipartFile file){
        return ${pojo_name ? uncap_first}Service.excelImport(file);
    }
}